@include('admin._include.header')
<style>
    .class-item:not(:first-child) {
        width: 49%;
        float: left;
    }

    .class-item:not(:first-child):nth-child(odd) {
        margin-left: 2%;
    }

    .layui-elem-quote {
        margin: 20px 0;
        background-color: #fff;
    }
    .layui-text h3{
        font-size: 15px;
    }

</style>
<body class="auth-user">
<div class="layui-fluid">
    <div class="layui-row larryms-panel auth-user-add">
        <form class="layui-form layui-form-pane" method="post">

            <div class="class-item">

                <blockquote class="layui-elem-quote">商品信息：</blockquote>

                <table class="layui-table">
                    <colgroup>
                        <col>
                        <col>
                        <col>
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>商品ID</th>
                        <th>图片</th>
                        <th>名称</th>
                        <th>数量</th>
                        <th>原价（元）</th>
                        <th>实付（元）</th>
                        <th>规格</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach ($order->details as $item)
                        <tr>
                            <td style="text-align: center">
                                {{$item->good_id}}
                            </td>
                            <td class="sku_item_image">
                                <img src="{{$item->goods_image}}" alt="">
                            </td>
                            <td>
                                {{$item->good_name}}
                            </td>

                            <td>
                                {{$item->goods_count}}
                            </td>
                            <td>
                                {{$item->goods_price}}
                            </td>
                            <td>
                                {{$item->goods_pay_price}}
                            </td>
                            <td>
                                {{$item->attribute_value}}
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>

            <div class="class-item">

                <blockquote class="layui-elem-quote">收货信息：</blockquote>

                <div class="layui-form-item">
                    <label class="layui-form-label">收货地址</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->address}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">联系人</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->name}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->phone}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">买家留言</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <textarea name="" style="height: 100px" class="layui-textarea" id="" cols="30" rows="10">{{$order->message}}</textarea>
                    </div>
                </div>


                <blockquote class="layui-elem-quote">订单数据：</blockquote>

                <div class="layui-form-item">
                    <label class="layui-form-label">订单编号</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->order_sn}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">原价金额</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->amount}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">实付金额</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->pay_amount}}"
                               class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">订单状态</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="" disabled value="{{$order->status_string}}"
                               class="layui-input">
                    </div>
                </div>

            </div>


            <div class="class-item" style="min-height: 400px">

                <blockquote class="layui-elem-quote">物流信息：

                    @if($order->status > 2)
                    <button class="layui-btn-xs layui-btn update-express" type="button" style="float: right">更新物流</button>
                    @endif

                </blockquote>

                @if($order->status > 2)
                <div class="layui-form-item">
                    <label class="layui-form-label">快递公司</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="快递公司" disabled
                               value="{{$order->express->express_name ?? ''}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">快递单号</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="快递单号" disabled
                               value="{{$order->express->express_sn ?? ''}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">快递状态</label>
                    <div class="layui-input-inline" style="width: 450px">
                        <input type="text"  placeholder="快递状态" disabled
                               value="{{$order->express->status_msg ?? ''}}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">物流信息</label>
                    <div class="layui-input-inline" style="width: 450px;padding: 10px">

                        <ul class="layui-timeline">
                            @if($order->express->express_details)
                                @foreach(json_decode($order->express->express_details, true) as $item)
                                    <li class="layui-timeline-item">
                                        <i class="layui-icon layui-timeline-axis"></i>
                                        <div class="layui-timeline-content layui-text">
                                            <h3 class="layui-timeline-title">{{$item['AcceptTime']}}</h3>
                                            <p>{{$item['AcceptStation']}}</p>
                                        </div>
                                    </li>
                                @endforeach
                            @endif

                        </ul>

                    </div>
                </div>

                @endif

            </div>



            <div class="clear"></div>
            <div style="height: 100px"></div>

        </form>
    </div>
</div>

<script>

    $('.update-express').on('click', function () {
        var index = layer.load(1);
        $.ajax({
            url:"{{url('order/update-express')}}",
            data:{
              'id':"{{$order->id}}"
            },
            dateType:'json',
            type:'post',
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            success:function (res) {
                layer.close(index);
                layer.msg(res.message);
                location.reload()
            }
        });
    });

    layui.config({
        base: "/plugin/layuiadmin/" //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'upload', 'form'], function () {
        var $ = layui.jquery;


    });
</script>

</body>
@include('admin._include.footer')